package com.hancher.gamelife2.main;

import android.annotation.SuppressLint;
import android.os.Bundle;

import com.flyco.tablayout.listener.CustomTabEntity;
import com.hancher.common.androidutil.LogUtil;
import com.hancher.common.base.BaseFragment;
import com.hancher.common.tab.TabViewPagerAdapter;
import com.hancher.common.tab.ViewPagerTabUtil;
import com.hancher.gamelife2.R;
import com.hancher.gamelife2.databinding.FragmentMainBinding;
import com.hancher.gamelife2.function.FunctionFragment;
import com.hancher.gamelife2.home.HomeFragment;

import java.util.ArrayList;

/**
 * 作者 : Hancher ytu_shaoweijie@163.com <br/>
 * 时间 : 2023/3/12 0012 22:49 <br/>
 * 描述 :
 */
public class MainFragment extends BaseFragment<FragmentMainBinding> {
    private ArrayList<CustomTabEntity> mTabEntities = new ArrayList<>();

    @SuppressLint("DefaultLocale")
    @Override
    protected void initView(Bundle savedInstanceState) {
        LogUtil.d("当前Fragment" + this);
        mTabEntities.clear();
        mTabEntities.add(new TabViewPagerAdapter.TabEntity("主页", new HomeFragment(),
                R.drawable.icon_home,
                R.drawable.icon_home));
        mTabEntities.add(new TabViewPagerAdapter.TabEntity("功能", new FunctionFragment(),
                R.drawable.icon_me,
                R.drawable.icon_me));

        new ViewPagerTabUtil.Build()
                .setViewpager(binding.viewpager)
                .setmTabEntities(mTabEntities)
                .setViewpagertab(binding.viewpagertab)
                .setSupportFragmentManager(getChildFragmentManager())
                .build();
    }

    @Override
    protected void initListener() {
    }

    @Override
    protected void initData() {
    }
}